﻿namespace FiftyOne.Foundation.Mobile.Detection.Wurfl.Handlers
{
    using FiftyOne.Foundation.Mobile.Detection.Wurfl;
    using System;

    internal class FirefoxDesktopHandler : FirefoxHandler
    {
        private const string DEFAULT_DEVICE = "firefox";
        private const byte EXTRA_CONFIDENCE = 1;
        private static readonly string[] SUPPORTED_ROOT_DEVICES = new string[] { "firefox" };

        protected internal override bool CanHandle(string userAgent)
        {
            return (((userAgent.Contains("Firefox") || userAgent.Contains("Iceweasel")) || (userAgent.Contains("Thunderbird") || userAgent.Contains("Gecko/"))) && ((userAgent.Contains("(Macintosh;") || userAgent.Contains("(Windows;")) || userAgent.Contains("(X11;")));
        }

        internal override byte Confidence
        {
            get
            {
                return (byte) (base.Confidence + 1);
            }
        }

        internal override DeviceInfo DefaultDevice
        {
            get
            {
                DeviceInfo deviceInfoFromID = Provider.Instance.GetDeviceInfoFromID("firefox");
                if (deviceInfoFromID != null)
                {
                    return deviceInfoFromID;
                }
                return base.DefaultDevice;
            }
        }

        protected override string[] SupportedRootDeviceIds
        {
            get
            {
                return SUPPORTED_ROOT_DEVICES;
            }
        }
    }
}

